<!--
 * @Author: '浪川' '1214391613@qq.com'
 * @Date: 2025-07-21 15:37:12
 * @LastEditors: '浪川' '1214391613@qq.com'
 * @LastEditTime: 2025-08-08 11:27:58
 * @FilePath: \passiflora-edulis-sims\src\pages\CreateBook\DrawBookStepPage.vue
 * @Description: 创建书籍的设置页面
 *
 * Copyright (c) 2025 by '1214391613@qq.com', All Rights Reserved.
-->
<script setup lang="ts">
import { ref, watch } from 'vue'
import PageSettingComponent from 'src/components/CreateBook/PageSettingComponent.vue'
import BookSettingComponent from 'src/components/CreateBook/BookSettingComponent.vue'
import WordSearchSettingComponent from 'src/components/CreateBook/WordSearchSettingComponent.vue'
import CrossWordSettingComponent from 'src/components/CreateBook/CrossWordSettingComponent.vue'
import { usePuzzleReqStore } from 'src/stores/CreateBook/puzzle-req-store'

const step = ref<number>(1)

const setting_num = ref<number>(2)
const show_next_button = ref<boolean>(true)
watch(step, (new_val, old_val) => {
  show_next_button.value = true
  if (new_val < 1) {
    new_val = old_val
  }
  if (new_val >= setting_num.value) {
    show_next_button.value = false
  }
})

// 获取 当前所需要展示的列表选项
const puzzle_req_store = usePuzzleReqStore()
</script>
<template>
  <div>
    <div style="padding: 1px">
      <h3>书籍基础设置</h3>
      <div>
        <div v-show="step == 1">
          <PageSettingComponent />
        </div>
        <div v-show="step == 2">
          <BookSettingComponent />
          <div v-show="puzzle_req_store.puzzle_mould === 'WordSearch'">
            <WordSearchSettingComponent />
          </div>
          <div v-show="puzzle_req_store.puzzle_mould === 'CrossWord'">
            <CrossWordSettingComponent />
          </div>
        </div>
      </div>

      <q-separator spaced />
      <div class="row q-gutter-sm">
        <div v-show="step > 1" class="col-2">
          <q-btn
            style="width: 100%"
            color="primary"
            label="上一页"
            @click="step -= 1"
          />
        </div>

        <div class="col-2" v-show="show_next_button">
          <q-btn
            style="width: 100%"
            color="primary"
            label="下一页"
            @click="step += 1"
          />
        </div>
      </div>
    </div>
  </div>
</template>

<style scoped></style>
